﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Fibonacci
{
    public static class Fibonacci
    {
        static Fibonacci()
        {
            Lookup = new ulong[Capacity];
        }
        public static ulong[] Lookup { get; private set; }
        public const uint Capacity = 100;

        public static ulong Calculate(uint n)
        {
            if (n == 0) return 0;
            if (n == 1) return 1;

            if (Lookup[n] == 0)
            {
                Lookup[n] = Calculate(n - 1) + Calculate(n - 2);
            }

            return Lookup[n];
        }
    }
}
